/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2022-12-05 12:24:25
 * @LastEditTime: 2022-12-05 12:48:02
 * @LastEditors: 赵大壮
 */
import nyNetwork from "@/api/nyBaseNetwork";
import DZModelPage from "@/model/DZModelPage";
import DZModelUserExpert from "@/views/订单管理/model/DZModelUserExpert";

class DZServiceUserSubscribe {

    m_page = new DZModelPage(15);

    list_user_subscribe: Array<DZModelUserExpert> = [];

    p_theme_id = null;

    p_time = null;

    net_list_user_subscribe() {
        var arr_data = [];
        nyNetwork.net("预约用户列表", { theme: this.p_theme_id, time: this.p_time ? this.p_time / 1000 : null, ...this.m_page }, data => {
            this.m_page.total = data.total;
            for (const item of data.list) {
                var model = new DZModelUserExpert();
                model.id = item.iid ?? '';
                model.expertName = item.sexportName ?? '';
                model.visitors = item.svisitors ?? '';
                model.phone = item.sphone ?? '';
                model.type = item.stype ?? '';
                model.time = item.createTime ?? '';
                model.handler = item.ihandle ?? 0;
                arr_data.push(model);
            }
            this.list_user_subscribe = arr_data;
        })
    }

    net_export_data(isAll) {
        var params = isAll ? { theme: this.p_theme_id, time: this.p_time / 1000 } : { ...this.m_page, theme: this.p_theme_id, time: this.p_time ? this.p_time / 1000 : null }
        nyNetwork.downFile("导出预约用户", params, "预约咨询用户.xlsx")
    }

    net_do_handler(id, success: () => void) {
        nyNetwork.net("处理预约记录", { id: id }, data => {
            success();
        })
    }
}
export default DZServiceUserSubscribe;